<?php
/**
 * @package		Joomla.Site
 * @subpackage	com_forum
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');

?>

<div class="categories-list<?php echo $this->pageclass_sfx;?>">
<h1>
	<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>

	<?php 	//If there is a description in the menu parameters use that; ?>
		<?php if($this->params->get('categories_description')) : ?>
			<div class="category-desc base-desc">
			<?php echo JHtml::_('content.prepare', $this->params->get('categories_description'), '', 'com_forum.categories'); ?>
			</div>
		<?php  else: ?>
			<?php //Otherwise get one from the database if it exists. ?>
			<?php  if ($this->parent->description) : ?>
				<div class="category-desc base-desc">
					<?php echo JHtml::_('content.prepare', $this->parent->description, '', 'com_forum.categories'); ?>
				</div>
			<?php  endif; ?>
		<?php  endif; 
$class = ' class="first"';

if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
?>

<ul>
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
	<?php
	
	if(!isset($this->items[$this->parent->id][$id + 1]))
	{
		$class = ' class="last"';
	}
	?>
	
	<li<?php echo $class; ?>>
	<?php $class = ''; ?>
		<span class="item-title"><a href="<?php echo JRoute::_(('index.php?option=com_forum&view=category&id=' .$item->id));?>">
			<?php echo $this->escape($item->title); ?></a>
		</span>
		<?php if ($item->description) : ?>
			<div class="category-desc">
				<?php echo JHtml::_('content.prepare', $item->description, '', 'com_forum.categories'); ?>
			</div>
		<?php endif; ?>
	</li>

	<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
